package com.jxs.android.weiget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.jxs.android.ges.R;

public class CustomerViewItem extends LinearLayout {

	public static enum BackGroud {
		HEAD, BODY, TAIL;
	}

	private TextView name, value;

	public CustomerViewItem(Context context) {
		this(context, null);
	}

	public CustomerViewItem(Context context, AttributeSet attrs) {
		super(context, attrs);
		LayoutInflater flater = LayoutInflater.from(context);
		flater.inflate(R.layout.bu_common_customer_view, this);
		name = (TextView) findViewById(R.id.item_name);
		value = (TextView) findViewById(R.id.item_value);
	}

	public void setName(String name) {
		this.name.setText(name);
	}

	public void setValue(String value) {
		this.value.setText(value);
	}

	public void setBackgroud(BackGroud backGroud) {
		if (backGroud.ordinal() == BackGroud.HEAD.ordinal()) {
			this.setBackgroundResource(R.drawable.roundlist_head);
		} else if (backGroud.ordinal() == BackGroud.BODY.ordinal()) {
			this.setBackgroundResource(R.drawable.roundlist_body);
		} else if (backGroud.ordinal() == BackGroud.TAIL.ordinal()) {
			this.setBackgroundResource(R.drawable.roundlist_tail);
		}
	}
}
